CMAKE_MINIMUM_REQUIRED( VERSION 3.1.1 )
PROJECT( plg_qt_common )

INCLUDE( WGToolsCoreProject )
find_package(QT5)

SET( ALL_SRCS
	plg_qt_common.cpp
)
WG_AUTO_SOURCE_GROUPS( ${ALL_SRCS} )


SET(QRC_FILE
	resources.qrc
)
source_group("Resource Files" FILES ${QRC_FILE})
qt5_add_resources(COMPILED_RESOURCES ${QRC_FILE})
SOURCE_GROUP("Compiled Resources" FILES ${COMPILED_RESOURCES})

BW_QT_ADD_QRC(WGControls resources/WGControls)
BW_QT_ADD_QRC(private resources/private)
BW_QT_ADD_CONFIG_QRC()
BW_GLOB_RESOURCE_FILES()

FILE( GLOB PLUGIN_RESOURCES resources/fonts/*)
BW_COPY_PLUGIN_RESOURCES( "${PLUGIN_RESOURCES}" )

BW_BLOB_SOURCES( BLOB_SRCS
	${ALL_SRCS}
)

BW_ADD_TOOL_PLUGIN( ${PROJECT_NAME} SHARED
	${BLOB_SRCS}
	${RESOURCE_FILES}
	${COMPILED_RESOURCES}
	${PLUGIN_RESOURCES}
)

IF(BW_PLATFORM_WINDOWS)
	SET(PLATFORM_LIBRARIES shlwapi)
ELSE()
	SET(PLATFORM_LIBRARIES)
ENDIF()

IF (Qt5_WEB_ENGINE_SUPPORT)
	ADD_DEFINITIONS( -DUSE_Qt5_WEB_ENGINE=1 )
	SET(Qt5_WEB_ENGINE_LIBRARY Qt5::WebEngine)
ELSE()
	SET(Qt5_WEB_ENGINE_LIBRARY)
ENDIF()

BW_TARGET_LINK_LIBRARIES( ${PROJECT_NAME} PRIVATE
	core_common
	core_generic_plugin
	core_qt_common
	core_ui_framework
	Qt5::Core
	Qt5::Gui
	Qt5::Quick
	Qt5::QuickWidgets
	Qt5::Widgets
	${Qt5_WEB_ENGINE_LIBRARY}

	# external libraries
	${PLATFORM_LIBRARIES}  
)

BW_DEPLOY_QT()

BW_PROJECT_CATEGORY( ${PROJECT_NAME} "Plugins" )
